<?php
/**
 * Created by PhpStorm.
 * User: Vc_JiuMou
 * Date: 2018/9/14
 * Time: 23:23
 */

    include('./lib.php');
    include('./header.html');


    $username = P('username');
    $password = P('password');

    if(!$username || !$password){
        error('请填写完整');
    }

    $redis = connectRedis();
    $reid = $redis->get('user:username:'.$username.':userid');
    if(!$reid){
        error('没有该用户');
    }
    $repwd = $redis->get('user:id:'.$reid.':pwd');
    if($repwd !== $password){
        error('密码错误');
    }

    setcookie('usernaem',$username);
    setcookie('userid',$reid);

    success('登入成功','./home.php');
    include('footer.html');